package com.zhongyu.viki.controller;
import com.zhongyu.viki.domain.Test;
import com.zhongyu.viki.service.TestService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RestController
public class testcontroller {
    @Value("${test.hello:TEST}")
    private String testHello;
    @RequestMapping("/hello")
    public String hello() { return "hello world!"+testHello;}

    @PostMapping("/hello/post")
    public String helloPost(String name){
        return "hello world! post," + name ;
    }


    @Resource
    private TestService testService;

    @GetMapping("/test/list")
    public List<Test> list(){
        return testService.list();
    }
}
